let app = getApp();
function outTimeFn  () { // 登陆过期
  let _this = this;
  let url = app.globalData.url;
  let userInfo = wx.getStorageSync('userInfo');
  let token = "";
  if (!userInfo) {
     return ;
  }
  
  token = userInfo.access_id;
  wx.request({
    url: url, 
    method: "get",
    data: {    
        api: 'app.login.token',
        storeId: 1,
        storeType: 6,
        accessId: token
    },
    header: {
      'content-type': 'application/json'  
    },
    success (res) {
      console.log("luoke out")
      console.log(res)
      let resData = res.data;
        if (resData.code == 200 && !resData.data.login_status) {
           // wx.clearStorage()
            wx.showToast({
              title: '登录过期',
              icon:"error",
              mask: true
            }, 2000)
            setTimeout(() => {
              wx.redirectTo({
                url: '/pages/login/login',
              })


          }, 2000);
        }
        if (resData.code == 200 && resData.data.login_status == 1) {

        }
    }
  })
}





module.exports = {
   outTimeFn: outTimeFn
}